from typing import List


class Solution:
    def constructArr(self, a: List[int]) -> List[int]:
        if not a:
            return []
        zuo = [1] * len(a)
        you = [1] * len(a)
        # zuo[0] = a[0]
        # you[-1]=a[-1]
        for i in range(1, len(zuo)):
            zuo[i] = zuo[i - 1] * a[i-1]
        for i in range(len(a)-2,-1,-1):
            you[i]=you[i+1]*a[i+1]
        ans=[]
        for i in range(len(zuo)):
            ans.append(zuo[i]*you[i])
        return ans


if __name__ == '__main__':
    s = Solution()
    nums=[1,2,3,4,5]
    s.constructArr(nums)